﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SystemUpdate
{
    public partial class Step1 : UserControl
    {
        UpdateSettings settings;

        public Step1( UpdateSettings _settings )
        {
            settings = _settings;

            InitializeComponent();

            this.DownloadFromHTTP.Checked = settings.DownloadFromHTTP;
            this.DownloadFromFTP.Checked  = settings.DownloadFromFTP;
            this.DownloadFromUSB.Checked  = settings.DownloadFromUSB;            
        }

        private void EnableNextButon()
        {
            SystemUpdate.SystemUpdateForm f = (SystemUpdate.SystemUpdateForm)Program.mainForm;// this.Parent.Parent;

            if (f != null)
            {
                settings.DownloadFromHTTP = this.DownloadFromHTTP.Checked;
                settings.DownloadFromFTP = this.DownloadFromFTP.Checked;
                settings.DownloadFromUSB = this.DownloadFromUSB.Checked;

                f.Next.Enabled = true;
            }
        }

        private void DownloadFromFTP_CheckedChanged(object sender, EventArgs e)
        {
            EnableNextButon();
        }

        private void DownloadFromHTTP_CheckedChanged(object sender, EventArgs e)
        {
            EnableNextButon();
        }

        private void DownloadFromUSB_CheckedChanged(object sender, EventArgs e)
        {
            EnableNextButon();
        }
    }
}
